package com.geekaca.oopd3.innerclass;

public class TestMain {
    public static void main(String[] args) {
        Animal animal = new Tiger();
        animal.run();

        // 就地继承 ,匿名内部类
        Animal animal1= new Animal() {
            @Override
            public void run() {
                System.out.println("匿名类动物跑");
            }
        };
        animal1.run();

        Fly fly = new Fly() {
            @Override
            public void canFly() {
                System.out.println("匿名的不知名的会飞的动物");
            }
        };
        fly.canFly();
    }
}

class Tiger extends Animal{
    @Override
    public void run() {
        System.out.println("老虎跑");
    }
}

abstract class Animal {
    public abstract void run();
}
